<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        background-color: #333;
      }
    </style>
  </head>
  <body>
    <script>
      // js引擎把函数的this绑定到调用函数的对象上
      function foo() {
        console.log('foo', this);
      }

      const obj = {
        foo,
      };

      obj.foo();
    </script>
  </body>
</html>
